package com.whatever.slip.jclq;

import com.whatever.lottery.jclq.Bet;
import com.whatever.lottery.jclq.Pass;

public class SlipJCLQ {
	
	public static String parse(Bet bet, int type) throws Exception{
		Pass pass = Pass.valueOf("PASS"+bet.getPass().replace('*', '_'));
		int itemCount = bet.getItemList().size();
		
		ISlipJCLQ slip;
		if (pass.equals(Pass.PASS1_1)){
			if (itemCount <= 3){
				slip = new SlipJCLQ3();
			} else if (itemCount <= 6){
				slip = new SlipJCLQ6();
			} else {
				slip = new SlipJCLQ8();
			}
			
		}else if (pass.ordinal() <= Pass.PASS3_4.ordinal()){
			slip = new SlipJCLQ3();
		} else if (pass.ordinal() <= Pass.PASS6_57.ordinal()){
			slip = new SlipJCLQ6();
		} else {
			slip = new SlipJCLQ8();
		}
		
		return slip.draw(bet, type);
	}
}
